<#--<#-- Controller层代码生成器模板 -->
<#assign className = table.className>
<#assign modelName = className?uncap_first>
<#assign packageName = "io.xccit.train.${moduleName}.controller">
<#assign date = "${date}">
<#assign author = "CH_ywx">

package ${packageName}.controller;

import ${packageName}.model.${className};
import ${packageName}.service.${className}Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/${modelName}")
public class ${className}Controller {

    @Autowired
    private ${className}Service ${modelName}Service;

    @GetMapping("/{id}")
    public ${className} get${className}(@PathVariable Long id) {
        return ${modelName}Service.get${className}(id);
    }

    @PostMapping("/")
    public ${className} create${className}(@RequestBody ${className} ${modelName}) {
        return ${modelName}Service.create${className}(${modelName});
    }

    @PutMapping("/{id}")
    public ${className} update${className}(@PathVariable Long id, @RequestBody ${className} ${modelName}) {
        return ${modelName}Service.update${className}(id, ${modelName});
    }

    @DeleteMapping("/{id}")
    public void delete${className}(@PathVariable Long id) {
        ${modelName}Service.delete${className}(id);
    }
}
-->

